{extend name="base" /}
{block name="title"}
<title>在线支付-{$site_config.site_title}</title>
{/block}
{block name="body"}
	<script src="__JS__/jquery.qrcode.min.js" type="text/javascript" charset="utf-8"></script>
	<header class="page-header1">
		<a href="javascript:;" onClick="javascript:history.back(-1);"><img src="__STATIC__/img/back02.png" class="back_img" style="float:left;"/></a>
		<h3>在线支付</h3>
	</header>
	<div class="collect">
		<div class="collect_title">微信或支付宝扫一扫</div>
		<div class="qr" style="width: 250px;margin: 0 auto;padding: 20px 0;">
			<div id="qrcode" ></div>
		</div>
		<div class="collect_amount"></div>
	</div>
	<input type="hidden" name="order_id" id="order_id" value="{$order_id}">
    <script type="text/javascript">
		$("#qrcode").qrcode({
			render: "table", //table方式
			width: 250, //宽度
			height:250, //高度
			text: "{$url}" //任意内容
		});
	</script>
	<script language="JavaScript">
		// 由于微信支付完成后不可以跳转，这里写了个监听跳转
	    function Check(){
	    	//var order_id = "{$order_id}";
	    	var order_id = $("#order_id").val();
	    	if (order_id) {
	    		$.post("{$post_url}",{order_id:order_id},function(result){
			        if(result.status == 1) {
			        	// 置空order_id 停止轮询
			        	$("#order_id").val('');
			            dialog.success(result.message,result.url);
			            return false;
			        }
			    },"JSON");
	    	}
	    }
	    window.setInterval("Check()",3000);
	</script>
<script src="__JS__/layer/mobile/layer.js" type="text/javascript" charset="utf-8"></script>
<script src="__JS__/mdialog.js" type="text/javascript" charset="utf-8"></script>
{/block}

